<template>
  <div class="dialog-container">
    <div class="dialog-content">
      <el-form ref="elForm" :model="form" :rules="rules" size="mini" label-width="120px">
        <el-form-item label="是否通话:" prop="is_contact">
          <el-radio-group v-model="form.is_contact">
            <el-radio :label="1">是</el-radio>
            <el-radio :label="0">否</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="备注:" prop="remark ">
          <el-input type="textarea" :rows="3" placeholder="请输入备注" v-model="form.remark" width="50%" maxlength="500"> </el-input>
        </el-form-item>
        <el-form-item style="margin-bottom: 0; margin-top: 40px">
          <div class="panel-line flex-end">
            <el-button @click="onCancel">取消</el-button>
            <el-button :loading="loading" type="primary" @click="onSubmit">确定</el-button>
          </div>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import { apiNoticeApplyAdd } from '@/api/biddingNotice'

export default {
  name: 'DialogFollowUp',
  props: {
    id: String,
  },
  data() {
    return {
      loading: false,
      form: {
        is_contact: 1,
        remark: '',
      },
      rules: {
        is_contact: [{ required: true, message: '请输入', trigger: 'blur' }],
      },
    }
  },
  mounted() {},
  destroyed() {},
  methods: {
    // 取消
    onCancel() {
      this.$emit('close')
    },
    // 确定
    onSubmit() {
      this.loading = true
      this.form.id = this.id
      apiNoticeApplyAdd(this.form)
        .then((res) => {
          this.$message({
            message: '操作成功',
            type: 'success',
          })
          setTimeout(() => {
            this.loading = false
            this.$emit('success')
          }, 1000)
        })
        .catch(() => {
          this.loading = false
        })
    },
  },
}
</script>
